#include <stdio.h>
#include <stdlib.h>

int uninit_global;
int init_global = 0;
int main(int argc, char* argv[], char* env[])
{
    printf("code address: %p\n", main);
    const char* str = "Hello Linux!\n";
    printf("read only char address: %p\n", str);
    printf("init global value address: %p\n", &init_global);
    printf("uninit global value address: %p\n", &uninit_global);
    
    char* heap1 = (char*)malloc(sizeof(char)*100);
    char* heap2 = (char*)malloc(sizeof(char)*100);
    char* heap3 = (char*)malloc(sizeof(char)*100);
    char* heap4 = (char*)malloc(sizeof(char)*100);
    static int a = 0;
    printf("heap1 address: %p\n", heap1);
    printf("heap2 address: %p\n", heap2);
    printf("heap3 address: %p\n", heap3);
    printf("heap4 address: %p\n", heap4);
    
    printf("stack address: %p\n", &str);
    printf("stack address: %p\n", &heap1);
    printf("stack address: %p\n", &heap2);
    printf("stack address: %p\n", &heap3);
    printf("stack address: %p\n", &heap4);
    printf("a address: %p\n", &a);
    
    int i = 0;
    for(i = 0; i < argc; i++)
    {
        printf("argv[%d]: %p\n", i, argv[i]);
    }

    for(i = 0; env[i]; i++)
    {
        printf("env[%d]: %p\n", i, env[i]);
    }

    return 0;
}
